﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace SimpleSurvival.src
{
    //-----------------------------------------------//
    //CLASS - ScriptReader.cs
    //-----------------------------------------------//
    //Global access
    //Reads data from txt files
    //and loads into a list in string arrays.
    public static class ScriptReader
    {
        public static List<string[]> GetData(string path)
        {
            List<string[]> resData = new List<string[]>();
            string[] data = File.ReadAllLines(path, Encoding.Default);
            foreach (string s in data)
            {
                string[] delimitedData = s.Split(new string[] { "\t", " " }, 10,
                    StringSplitOptions.RemoveEmptyEntries);

                if (s.Count() > 0 && s.ToArray()[0] != '#')
                {
                    resData.Add(delimitedData);
                }
            }
            foreach (string[] s in resData)
            {
                foreach (string s2 in s)
                {
                    Console.WriteLine(s2);
                }
            }
            return resData;
        }
    }
}
